<!DOCTYPE html>
<html>
<head>
    <title>运营</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link rel="stylesheet" href="css/operate.css">
</head>
<body>
<div class="select_time">
    <span class="select_date">选择日期</span>
    <input type="button" class="select_prev" value="上一天">
    <input type="button" class="select_next" value="下一天">
    <input type="button" class="select_now" value="当天">
    <span class="write_date"></span>
</div>
<div class="cover_big">
    <div id="cover"></div>
</div>
<div class="content">
    <div id="newPulpLinks"></div>
    <div id="allPulpLinks"></div>
    <div id="gradeAnalysis"></div>
</div>
<div id="gantt"></div>
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="js/echarts.min.js"></script>
<script type="text/javascript" src="js/template.js"></script>
<script type="text/javascript" src="js/vii-placeholder.js"></script>
<script language="javascript">
    var big;
    var placeholder = new PlaceHolder({
        zIndex: 99999999999999,
        type: 'loading',
        color: '#FFF',
        background: 'rgba(0,0,0,.6)',
        text: "正在加速加载中...",
        template:
            '<img class="vii-placeholder-loading" src="images/loading.gif" width="30"/>\
             <span class="vii-placeholder-label" style="display: block;margin-top: 10px;font-size: 16px">{{ text }}</span>'
    });

    /*
    * isTime
    * 正则验证时间
    * */
    function isTime(value) {
        var myreg = /([0-9][0-9]):([0-5][0-9])/;
        if (!myreg.test(value)) {
            return false;
        } else {
            return true;
        }
    }

    /*
    * closeGunterDetail
    * 关闭运行图表（视频和联动折线图）详情
    * */
    function closeGunterDetail() {
        $(".cover_big").fadeOut();
        $("#cover").fadeOut().removeAttr("_echarts_instance_").removeAttr("style");
        $("#gunterDetail").fadeOut();
    }

    /*
    * NowDay
    * 获取今天日期
    * */
    function NowDay() {
        var date = new Date();
        var y = date.getFullYear();
        var m = (date.getMonth() + 1).toString().length === 1 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
        var d = date.getDate().toString().length === 1 ? "0" + date.getDate() : date.getDate();
        return y + "-" + m + "-" + d;
    }

    NowDay();


    /*
    * 初始化页面
    * 全局变量
    * */


    $(".write_date").text(NowDay());
    $("#cover").removeAttr("_echarts_instance_").removeAttr("style").html("");
    var gradeAnalysisSend = {
        a: 14,
        b: 28,
        c: 42,
        d: 56
    }, nurseListID = [], gantChartData, configGantChartData, gantChartIsChecked, legendSelect;
    var color = ['#e95e48', '#DC951F', '#DDB100', '#DAD503', '#8AC867', '#33CC99', '#37B8D4', '#7BCFE7', '#6A9BD3'];


    /*
    *
    * 采浆室护士列表
    * */
    var nurseList = [
        {id: 'mxz14', name: '於孝楼'},
        {id: 'mxz18', name: '王爱弟'},
        {id: 'mxz19', name: '张 君'},
        {id: 'mxz20', name: '马淑琴'},
        {id: 'mxz26', name: '褚义霞'},
        {id: 'mxz42', name: '孔德雅'},
        {id: 'mxz43', name: '黄亚琴'},
        {id: 'mxz45', name: '刘凯丽'},
        {id: 'mxz46', name: '王小艳'},
        {id: 'mxz47', name: '陈丽阳'}
    ];

    for (var n = 0; n < nurseList.length; n++) {
        nurseListID.push(nurseList[n].name);
    }
    /*
    * getCollectionTime
    * 获取（甘特图）采浆标准时间数据
    * */
    function getCollectionTime(callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/display/collectionTimeSetting",
            dataType: 'jsonp',
            success: function (list) {
               callback(list);
            },
            error: function (XMLHttpRequest) {
                alert("采浆标准时间数据请求失败！")
            }
        });
    }
    gantChartData = {
        nurseListID: nurseListID,
        installTakensSmall: "",
        installTakensBig: "",
        installSpaceTakensSmall: "",
        installSpaceTakensBig: "",
        punctureTakensSmall: "",
        punctureTakensBig: "",
        collectionTakens: {
            two: {
                collectionTakensSmall: "",
                collectionTakensBig: ""
            },
            three: {
                collectionTakensSmall: "",
                collectionTakensBig: ""
            },
            four: {
                collectionTakensSmall: "",
                collectionTakensBig: ""
            },
            five: {
                collectionTakensSmall: "",
                collectionTakensBig: ""
            },
            six: {
                collectionTakensSmall: "",
                collectionTakensBig: ""
            }
        },
        uninstallTakensSmall: "",
        uninstallTakensBig: ""
    };
    getCollectionTime(function (items) {
        configGantChartData = {
            installTakensSmall: items.installStartTime ? items.installStartTime : "",
            installTakensBig: items.installEndTime ? items.installEndTime : "",
            installSpaceTakensSmall: items.installSpaceStartTime ? items.installSpaceStartTime : "",
            installSpaceTakensBig: items.installSpaceEndTime ? items.installSpaceEndTime : "",
            punctureTakensSmall: items.punctureStartTime ? items.punctureStartTime : "",
            punctureTakensBig: items.punctureEndTime ? items.punctureEndTime : "",
            collectionTakens: {
                two: {
                    collectionTakensSmall: items.secondCollectionStartTime ? items.secondCollectionStartTime : "",
                    collectionTakensBig: items.secondCollectionEndTime ? items.secondCollectionEndTime : ""
                },
                three: {
                    collectionTakensSmall: items.thirdCollectionStartTime ? items.thirdCollectionStartTime : "",
                    collectionTakensBig: items.thirdCollectionEndTime ? items.thirdCollectionEndTime : ""
                },
                four: {
                    collectionTakensSmall: items.fourthCollectionStartTime ? items.fourthCollectionStartTime : "",
                    collectionTakensBig: items.fourthCollectionEndTime ? items.fourthCollectionEndTime : ""
                },
                five: {
                    collectionTakensSmall: items.fifthCollectionStartTime ? items.fifthCollectionStartTime : "",
                    collectionTakensBig: items.fifthCollectionEndTime ? items.fifthCollectionEndTime : ""
                },
                six: {
                    collectionTakensSmall: items.sixthCollectionStartTime ? items.sixthCollectionStartTime : "",
                    collectionTakensBig: items.sixthCollectionEndTime ? items.sixthCollectionEndTime : ""
                }
            },
            uninstallTakensSmall: items.uninstallStartTime ? items.uninstallStartTime : "",
            uninstallTakensBig: items.uninstallEndTime ? items.uninstallEndTime : ""
        };
    });
    gantChartIsChecked = {
        installTakensSmall: false,
        installTakensBig: false,
        installSpaceTakensSmall: false,
        installSpaceTakensBig: false,
        punctureTakensSmall: false,
        punctureTakensBig: false,
        collectionTakens: {
            two: {
                collectionTakensSmall: false,
                collectionTakensBig: false
            },
            three: {
                collectionTakensSmall: false,
                collectionTakensBig: false
            },
            four: {
                collectionTakensSmall: false,
                collectionTakensBig: false
            },
            five: {
                collectionTakensSmall: false,
                collectionTakensBig: false
            },
            six: {
                collectionTakensSmall: false,
                collectionTakensBig: false
            }
        },
        uninstallTakensSmall: false,
        uninstallTakensBig: false
    };
    legendSelect = {
        "安装耗材时间": true,
        "安装耗材后空闲时间": true,
        "穿刺时间": true,
        "采浆时间": true,
        "卸载耗材时间": true,
        "空闲时间": true
    };

    /*
    * setDayStyle
    * 设置右上角按钮样式
    * */
    function setDayStyle() {
        var write = $(".write_date").text();
        if (write === NowDay()) {
            $(".select_next").css({
                display: "none"
            });
            $(".select_now").css({
                display: "none"
            });
        } else {
            $(".select_next").css({
                display: "inline-block",
                background: "#06B7E5",
                border: "1px solid #06B7E5",
                color: "#FFF"
            });
            $(".select_now").css({
                display: "inline-block",
                background: "#06B7E5",
                border: "1px solid #06B7E5",
                color: "#FFF"
            });
        }
    }

    setDayStyle();


    /*
    * selectDate
    * 选择查看某一天
    * */
    $(".select_date").on("click", function () {
        modal_confirm({
            title: '选择日期',
            content: '<div class="cover_data">' +
            '<input type="date" value="' + $(".write_date").text() + '">' +
            '</div>',
            onConfirm: function (event) {
                $(".write_date").text($(".cover_data input").val());
                setDayStyle();
                NewPulpAjax(function (items) {
                    newPulpLink("newPulpLinks", items);
                });
                AllPulpAjax(function (items) {
                    allPulpLink("allPulpLinks", items);
                });
                GradeAnalysisAjax(gradeAnalysisSend, function (items) {
                    gradeAnalysisLink("gradeAnalysis", items);
                });
                GantChartAjax(gantChartData, function (items) {
                    GanttLink("gantt", items);
                });
                close_cover();
            }
        });
    });

    /*
    * prevDay
    * 查看上一天
    * */
    $(".select_prev").on("click", function () {
        $(".write_date").text(getPrevDay($(".write_date").text()));
        setDayStyle();
        NewPulpAjax(function (items) {
            newPulpLink("newPulpLinks", items);
        });
        AllPulpAjax(function (items) {
            allPulpLink("allPulpLinks", items);
        });
        GradeAnalysisAjax(gradeAnalysisSend, function (items) {
            gradeAnalysisLink("gradeAnalysis", items);
        });
        GantChartAjax(gantChartData, function (items) {
            GanttLink("gantt", items);
        });
    });

    /*
    * nextDay
    * 查看下一天
    * */
    $(".select_next").on("click", function () {
        $(".write_date").text(getNextDay($(".write_date").text()));
        setDayStyle();
        NewPulpAjax(function (items) {
            newPulpLink("newPulpLinks", items);
        });
        AllPulpAjax(function (items) {
            allPulpLink("allPulpLinks", items);
        });
        GradeAnalysisAjax(gradeAnalysisSend, function (items) {
            gradeAnalysisLink("gradeAnalysis", items);
        });
        GantChartAjax(gantChartData, function (items) {
            GanttLink("gantt", items);
        });
    });

    /*
    * nowDay
    * 查看当天
    * */
    $(".select_now").on("click", function () {
        window.location.reload();
    });


    /*
    * getSubText
    * 获取副标题
    * */
    function getSubText(name, small, big) {
        if (small !== "" && big !== "") {
            return " -- " + name + "【" + small + "之下," + big + "之上】";
        } else if (small !== "" && big === "") {
            return " -- " + name + "【" + small + "之下】";
        } else if (small === "" && big !== "") {
            return " -- " + name + "【" + big + "之上】";
        } else {
            return "";
        }
    }

    /*
    * newPulp
    * 获取新浆员（散点图）数据
    * */
    function NewPulpAjax(callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/display/NewProvider",
            dataType: 'jsonp',
            type: 'GET',
            data: {
                date: $(".write_date").text()
            },
            success: function (list) {
                callback(list);
            },
            error: function (XMLHttpRequest) {
                alert("新献浆员数据请求失败！")
            }
        });
    }

    NewPulpAjax(function (items) {
        newPulpLink("newPulpLinks", items);
    });

    /*
    * AllPulp
    * 获取所有浆员（折线图）数据
    * */
    function AllPulpAjax(callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/display/ProviderProcess",
            dataType: 'jsonp',
            type: 'GET',
            data: {
                date: $(".write_date").text()
            },
            success: function (list) {
                callback(list);
            },
            error: function (XMLHttpRequest) {
                alert("所有献浆员数据请求失败！")
            }
        });
    }

    AllPulpAjax(function (items) {
        allPulpLink("allPulpLinks", items);
    });

    /*
    * GradeAnalysis
    * 获取所有浆员（饼图）数据
    * */
    function GradeAnalysisAjax(params, callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/JtTechServer/GetPieChartChartServlet",
            dataType: "json",
            type: 'GET',
            data: {
                gettime: $(".write_date").text(),
                FirstBlood: params.a,
                SecondBlood: params.b,
                ThirdBlood: params.c,
                FourthBlood: params.d
            },
            success: function (list) {
                callback(list);
            },
            error: function (XMLHttpRequest) {
                alert("浆龄占比图数据请求失败！");
            }
        });
    }

    GradeAnalysisAjax(gradeAnalysisSend, function (items) {
        gradeAnalysisLink("gradeAnalysis", items);
    });

    /*
    * GantChart
    * 获取所有采浆机运行（甘特图）数据
    * */
    function GantChartAjax(data, callback) {
        if (data.collectionTakens !== "") {
            if (data.collectionTakens.two.collectionTakensSmall === "" && data.collectionTakens.two.collectionTakensBig === "" && data.collectionTakens.three.collectionTakensSmall === "" && data.collectionTakens.three.collectionTakensBig === "" && data.collectionTakens.four.collectionTakensSmall === "" && data.collectionTakens.four.collectionTakensBig === "" && data.collectionTakens.five.collectionTakensSmall === "" && data.collectionTakens.five.collectionTakensBig === "" && data.collectionTakens.six.collectionTakensSmall === "" && data.collectionTakens.six.collectionTakensBig === "") {
                data.collectionTakens = "";
            }
        }
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/display/collectionRecord",
            dataType: "jsonp",
            data: {
                date: $(".write_date").text(),
                nurseList: data.nurseListID.join(","),
                installTakensSmall: data.installTakensSmall,
                installTakensBig: data.installTakensBig,
                installSpaceTakensSmall: data.installSpaceTakensSmall,
                installSpaceTakensBig: data.installSpaceTakensBig,
                punctureTakensSmall: data.punctureTakensSmall,
                punctureTakensBig: data.punctureTakensBig,
                collectionTakens: data.collectionTakens !== "" ? JSON.stringify(data.collectionTakens) : data.collectionTakens,
                uninstallTakensSmall: data.uninstallTakensSmall,
                uninstallTakensBig: data.uninstallTakensBig
            },
            beforeSend: function () {
                placeholder.show(document.body)
            },
            success: function (list) {
                callback(list);
            },
            error: function (XMLHttpRequest) {
                placeholder.hide(document.body);
                $(".vii-holder-mask").hide();
                alert("甘特图数据请求失败！");
            }
        });
    }

    GantChartAjax(gantChartData, function (items) {
        GanttLink("gantt", items);
        GanttLink("cover", items);
    });

    /*
    * setInterval
    * 定时更新数据
    * */
    setInterval(function () {
        switch (big) {
            case "a":
                NewPulpAjax(function (items) {
                    newPulpLink("cover", items);
                });
                break;
            case "b":
                AllPulpAjax(function (items) {
                    allPulpLink("cover", items);
                });
                break;
            case "c":
                GradeAnalysisAjax(gradeAnalysisSend, function (items) {
                    gradeAnalysisLink("cover", items);
                });
                break;
            case "d":
                GantChartAjax(gantChartData, function (items) {
                    GanttLink("cover", items);
                });
                break;
            case "e":
                break;
            default:
                NewPulpAjax(function (items) {
                    newPulpLink("newPulpLinks", items);
                });
                AllPulpAjax(function (items) {
                    allPulpLink("allPulpLinks", items);
                });
                GradeAnalysisAjax(gradeAnalysisSend, function (items) {
                    gradeAnalysisLink("gradeAnalysis", items);
                });
                GantChartAjax(gantChartData, function (items) {
                    GanttLink("gantt", items);
                });
        }
    }, 170000);

    /*
     * newPulpLink
     * 生成新浆员（散点图）图表
     * */
    function newPulpLink(id, items) {
        $("#cover").removeAttr("_echarts_instance_").removeAttr("style").html("");
        var myChart = echarts.init(document.getElementById(id));
        var names = ["建档", "体检", "采样", "胸透", "化检", "采浆", "费用", "热合"];
        var list = {offer: [], data: []};
        var creat = [], assay = [], bodyCheck = [], chestCheck = [], collection = [], cost = [], heat = [],
            sampleAssay = [];
        for (var p in items) {
            list.offer.push(items[p].name);
        }

        for (var i in items) {
            creat.push(!items[i].createTime ? "07:00" : items[i].createTime); //建档
            bodyCheck.push(!items[i].bodyCheckTime ? "07:00" : items[i].bodyCheckTime); //体检
            sampleAssay.push(!items[i].sampleAssayTime ? "07:00" : items[i].sampleAssayTime); //采样
            chestCheck.push(!items[i].chestCheckTime ? "07:00" : items[i].chestCheckTime); //胸透
            assay.push(!items[i].assayTime ? "07:00" : items[i].assayTime); //化检
            collection.push(!items[i].collectionTime ? "07:00" : items[i].collectionTime); //采浆
            cost.push(!items[i].costTime ? "07:00" : items[i].costTime); //费用
            heat.push(!items[i].heatTime ? "07:00" : items[i].heatTime); //热合
        }
        var times = [creat, bodyCheck, sampleAssay, chestCheck, assay, collection, cost, heat];

        for (var t in times) {
            list.data.push({
                name: names[t],
                time: times[t]
            })
        }
        var offers = list.offer;
        var option = {
            color: color,
            title: {
                text: '新浆员献浆过程图( 共 ' + items.length + " 人 )",
                textStyle: {
                    color: '#C8E1FD',
                    fontSize: 15,
                    fontFamily: '微软雅黑'
                }
            },
            toolbox: {
                itemSize: 22,
                feature: {
                    myTool1: {
                        show: true,
                        title: '放大',
                        icon: 'image://images/big.png',
                        onclick: function () {
                            big = "a";
                            $(".cover_big").fadeIn();
                            $("#cover").fadeIn();
                            NewPulpAjax(function (items) {
                                newPulpLink("cover", items);
                            });
                        }
                    },
                    myTool2: {
                        show: true,
                        title: '缩小',
                        icon: 'image://images/small.png',
                        onclick: function () {
                            big = "";
                            $(".cover_big").fadeOut();
                            $("#cover").fadeOut().removeAttr("_echarts_instance_").removeAttr("style");
                        }
                    }
                }
            },
            legend: {
                orient: 'vertical',
                left: 0,
                top: 35,
                textStyle: {
                    color: "#FFF"
                },
                data: (function () {
                    var legends = [];
                    for (var i in names) {
                        legends.push({
                            name: names[i],
                            icon: names[i] === '建档' ? 'triangle' : (names[i] === '热合' ? 'rect' : 'circle')
                        })
                    }
                    return legends;
                }())
            },
            polar: [{center: id === "cover" ? ["50%", "50%"] : ["60%", "50%"]}],
            grid: {
                right: '20%',
                top: '50%',
                containLabel: true
            },
            tooltip: {
                trigger: 'item',
                axisPointer: {
                    type: 'cross',
                    label: {
                        color: "rgba(0,0,0,0)",
                        backgroundColor: "rgba(0,0,0,0)"
                    },
                    crossStyle: {
                        color: "#C8E1FD"
                    }
                },
                formatter: function (params) {
                    return offers[params.value[0]] + '<br/>' +
                        (params.value[1] === "07:00" ? "时间待定" : params.value[1] ) +
                        "&nbsp;---&nbsp;" +
                        params.seriesName;
                }
            },
            angleAxis: {
                type: 'category',
                data: (function () {
                    var time = [];
                    for (var i = 1; i <= 12; i++) {
                        for (var k = 0; k < 60; k++) {
                            time.push((i.toString().length === 1 ? ( "0" + i ) : i) + ":" + (k.toString().length === 1 ? ( "0" + k ) : k));
                        }
                    }
                    return time;
                }()),
                boundaryGap: false,
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: (function () {
                            var colors = [];
                            for (var i = 1; i <= 12; i++) {
                                for (var k = 0; k < 60; k++) {
                                    colors.push((k === 0 || k === 30) ? "#FFF" : (k === 10 || k === 20 || k === 40 || k === 50) ? "#344a63" : "#173963");
                                }
                            }
                            return colors;
                        }()),
                        type: 'slide'
                    }
                },
                axisTick: {
                    show: id === "cover" ? true : false
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#FFF"
                    }
                },
                axisLabel: {
                    show: true,
                    formatter: function (params) {
                        return params.substr(params.indexOf(":") + 1) === "00" ? params : "";
                    }
                },
                startAngle: 60
            },
            radiusAxis: {
                type: 'category',
                data: (function () {
                    var radiusAxis = [];
                    for (var i = 0; i < offers.length; i++) {
                        radiusAxis.push(offers[i]);
                    }
                    return radiusAxis;
                }()),
                axisLine: {
                    show: false
                },
                axisLabel: {
                    rotate: 30,
                    color: "rgba(0,0,0,0)"
                }
            },
            series: (function () {
                var symbol = [
                        {
                            size: items.length > 13 && id !== "cover" ? 10 : 13,
                            type: 'triangle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'circle'
                        },
                        {
                            size: items.length > 13 && id !== "cover" ? 9 : 12,
                            type: 'rect'
                        }
                    ],
                    series = [],
                    datas = list.data;
                for (var i = 0, len = datas.length; i < len; i++) {
                    var time = datas[i].time;
                    var newTime = [];
                    for (var k = 0, newTime; k < time.length; k++) {
                        newTime.push({
                            value: [k, time[k]],
                            symbolSize: symbol[i].size,
                            symbol: symbol[i].type
                        });
                    }
                    datas[i].time = newTime;
                    series.push({
                        type: 'scatter',
                        coordinateSystem: 'polar',
                        symbolSize: 15,
                        name: datas[i].name,
                        data: datas[i].time
                    });
                }
                return series;

            })()
        };
        myChart.clear();
        myChart.setOption(option);
    }

    /*
     * allPulpLinks
     * 生成全部浆员（折线图）图表
     * */
    function allPulpLink(id, items) {
        $("#cover").removeAttr("_echarts_instance_").removeAttr("style").html("");
        var list = ["登记", "体检", "分配", "采浆前", "采浆后", "费用", "热合"];
        var myChart = echarts.init(document.getElementById(id));
        var option = {
            color: color,
            title: {
                text: '浆员献浆过程图',
                textStyle: {
                    color: '#C8E1FD',
                    fontSize: 15,
                    fontFamily: '微软雅黑'
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            toolbox: {
                itemSize: 22,
                feature: {
                    myTool1: {
                        show: true,
                        title: '放大',
                        icon: 'image://images/big.png',
                        onclick: function () {
                            big = "b";
                            $(".cover_big").fadeIn();
                            $("#cover").fadeIn();
                            AllPulpAjax(function (items) {
                                allPulpLink("cover", items);
                            });
                        }
                    },
                    myTool2: {
                        show: true,
                        title: '缩小',
                        icon: 'image://images/small.png',
                        onclick: function () {
                            big = "";
                            $(".cover_big").fadeOut();
                            $("#cover").fadeOut().removeAttr("_echarts_instance_").removeAttr("style");
                        }
                    }
                }
            },
            legend: {
                width: 300,
                left: 120,
                textStyle: {
                    color: "#FFF"
                },
                data: (function () {
                    var data = [];
                    for (var d = 0; d < list.length; d++) {
                        data.push({
                            name: list[d],
                            icon: 'circle'
                        })
                    }
                    return data;
                }())
            },
            grid: {
                left: '2%',
                right: '4%',
                bottom: 40,
                containLabel: true
            },
            dataZoom: [
                {
                    type: 'slider',
                    filterMode: 'weakFilter',
                    //start:20,
                    showDataShadow: true,
                    bottom: 10,
                    height: 5,
                    borderColor: 'transparent',
                    backgroundColor: '#e2e2e2',
                    handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z',
                    handleSize: 20,
                    handleStyle: {
                        shadowBlur: 6,
                        shadowOffsetX: 1,
                        shadowOffsetY: 2,
                        shadowColor: '#aaa'
                    },
                    labelFormatter: ''
                },
                {
                    type: 'inside',
                    filterMode: 'weakFilter'
                }
            ],
            xAxis: {
                type: 'time',
                boundaryGap: false,
                splitLine: {show: false},
                axisLine: {
                    lineStyle: {
                        color: "#F9F9F9"
                    }
                }
            },
            yAxis: {
                type: 'value',
                splitLine: {show: false},
                axisLine: {
                    lineStyle: {
                        color: "#F9F9F9"
                    }
                }
            },
            series: (function () {
                var series = [], register = [], bodyCheck = [],
                    allot = [], beforeCollection = [], afterCollection = [],
                    heat = [], cost = [];
                for (var i in items) {
                    register.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].register]
                    });
                    bodyCheck.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].bodyCheck]
                    });
                    allot.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].allot]
                    });
                    beforeCollection.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].beforeCollection]
                    });
                    afterCollection.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].afterCollection]
                    });
                    cost.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].cost]
                    });
                    heat.push({
                        name: items[i].time,
                        value: [items[i].time, items[i].heat]
                    });
                }
                var data = [register, bodyCheck, allot, beforeCollection, afterCollection, cost, heat];
                for (var d = 0; d < data.length; d++) {
                    series.push({
                        name: list[d],
                        type: 'line',
                        showSymbol: false,
                        hoverAnimation: false,
                        areaStyle: {normal: {}},
                        data: data[d]
                    })
                }
                return series;
            }())
        };
        myChart.clear();
        myChart.setOption(option);
    }

    /*
    * gradeAnalysisLink
    * 生成全部浆员（饼图）图表
    * */
    function gradeAnalysisLink(id, items) {
        $("#cover").removeAttr("_echarts_instance_").removeAttr("style").html("");
        var leng = items.allMsg.length;
        var lists = items.allMsg[0];
        var data = {
            inside: [
                {
                    code: "2017",
                    name: "今年",
                    value: leng > 0 ? lists.thisYearjd : 0
                },
                {
                    code: "2016",
                    name: "去年",
                    value: leng > 0 ? lists.lastYearjd : 0
                },
                {
                    code: "2015",
                    name: "前年",
                    value: leng > 0 ? lists.beforeYearjd : 0
                },
                {
                    code: "-1",
                    name: "其它",
                    value: leng > 0 ? lists.otherYearjd : 0
                }
            ],
            outside: [
                {
                    code: "2017",
                    name: "今年",
                    subCode: "1",
                    subName: gradeAnalysisSend.a + "-" + (gradeAnalysisSend.b - 1) + "天",
                    value: leng > 0 ? lists.firstBloodThis : 0
                },
                {
                    code: "2017",
                    name: "今年",
                    subCode: "2",
                    subName: gradeAnalysisSend.b + "-" + (gradeAnalysisSend.c - 1) + "天",
                    value: leng > 0 ? lists.secondBloodThis : 0
                },
                {
                    code: "2017",
                    name: "今年",
                    subCode: "3",
                    subName: gradeAnalysisSend.c + "-" + (gradeAnalysisSend.d - 1) + "天",
                    value: leng > 0 ? lists.thirdBloodThis : 0
                },
                {
                    code: "2017",
                    name: "今年",
                    subCode: "10000",
                    subName: gradeAnalysisSend.d + "天以上",
                    value: leng > 0 ? lists.forthBloodThis : 0
                },
                {
                    code: "2016",
                    name: "去年",
                    subCode: "1",
                    subName: gradeAnalysisSend.a + "-" + (gradeAnalysisSend.b - 1) + "天",
                    value: leng > 0 ? lists.firstBloodLast : 0
                },
                {
                    code: "2016",
                    name: "去年",
                    subCode: "2",
                    subName: gradeAnalysisSend.b + "-" + (gradeAnalysisSend.c - 1) + "天",
                    value: leng > 0 ? lists.secondBloodLast : 0
                },
                {
                    code: "2016",
                    name: "去年",
                    subCode: "3",
                    subName: gradeAnalysisSend.c + "-" + (gradeAnalysisSend.d - 1) + "天",
                    value: leng > 0 ? lists.thirdBloodLast : 0
                },
                {
                    code: "2016",
                    name: "去年",
                    subCode: "10000",
                    subName: gradeAnalysisSend.d + "天以上",
                    value: leng > 0 ? lists.forthBloodLast : 0
                },
                {
                    code: "2015",
                    name: "前年",
                    subCode: "1",
                    subName: gradeAnalysisSend.a + "-" + (gradeAnalysisSend.b - 1) + "天",
                    value: leng > 0 ? lists.firstBloodBefore : 0
                },
                {
                    code: "2015",
                    name: "前年",
                    subCode: "2",
                    subName: gradeAnalysisSend.b + "-" + (gradeAnalysisSend.c - 1) + "天",
                    value: leng > 0 ? lists.secondBloodBefore : 0
                },
                {
                    code: "2015",
                    name: "前年",
                    subCode: "3",
                    subName: gradeAnalysisSend.c + "-" + (gradeAnalysisSend.d - 1) + "天",
                    value: leng > 0 ? lists.thirdBloodBefore : 0
                },
                {
                    code: "2015",
                    name: "前年",
                    subCode: "10000",
                    subName: gradeAnalysisSend.d + "天以上",
                    value: leng > 0 ? lists.forthBloodBefore : 0
                },
                {
                    code: "-1",
                    name: "其它",
                    subCode: "1",
                    subName: gradeAnalysisSend.a + "-" + (gradeAnalysisSend.b - 1) + "天",
                    value: leng > 0 ? lists.firstBloodOther : 0
                },
                {
                    code: "-1",
                    name: "其它",
                    subCode: "2",
                    subName: gradeAnalysisSend.b + "-" + (gradeAnalysisSend.c - 1) + "天",
                    value: leng > 0 ? lists.secondBloodOther : 0
                },
                {
                    code: "-1",
                    name: "其它",
                    subCode: "3",
                    subName: gradeAnalysisSend.c + "-" + (gradeAnalysisSend.d - 1) + "天",
                    value: leng > 0 ? lists.thirdBloodOther : 0
                },
                {
                    code: "-1",
                    name: "其它",
                    subCode: "10000",
                    subName: gradeAnalysisSend.d + "天以上",
                    value: leng > 0 ? lists.forthBloodOther : 0
                }
            ]
        };
        var myChart = echarts.init(document.getElementById(id)),
            newArr = [];
        for (var i = 0; i < data.inside.length; i++) {
            newArr.push({
                name: data.inside[i].name,
                icon: 'circle'
            });
        }
        var option = {
            color: ["#ED0F08", "#ED8608", "#12D3EA", "#3179A7"],
            title: {
                text: '浆员浆龄与离上次献浆间隔' + '( 共' + (lists.thisYearjd + lists.lastYearjd + lists.beforeYearjd + lists.otherYearjd) + " 人 )",
                textStyle: {
                    color: '#C8E1FD',
                    fontSize: 15,
                    fontFamily: '微软雅黑'
                }
            },
            tooltip: {
                trigger: 'item',
                formatter: function (params) {
                    var html = params.name + '<br/>' + (typeof(params.data.subName) === "undefined" ? "" : params.data.subName + "： ") + params.value + "&nbsp;-->&nbsp;" + '<span style="color: yellow"> ' + params.percent + "%" + '</span>';
                    return html;
                }
            },
            toolbox: {
                itemSize: 22,
                feature: {
                    myTool1: {
                        show: true,
                        title: '放大',
                        icon: 'image://images/big.png',
                        onclick: function () {
                            big = "c";
                            $(".cover_big").fadeIn();
                            $("#cover").fadeIn();
                            GradeAnalysisAjax(gradeAnalysisSend, function (items) {
                                gradeAnalysisLink("cover", items);
                            });
                        }
                    },
                    myTool2: {
                        show: true,
                        title: '缩小',
                        icon: 'image://images/small.png',
                        onclick: function () {
                            big = "";
                            $(".cover_big").fadeOut();
                            $("#cover").fadeOut().removeAttr("_echarts_instance_").removeAttr("style");
                        }
                    },
                    myTool3: {
                        show: true,
                        title: '配置',
                        icon: 'image://images/setting.png',
                        onclick: function () {
                            modal_confirm({
                                title: '请输入间隔天数',
                                content: '<div class="select_number">\
                                            <p>1.<input type="number" value="14" disabled>---<input type="number" value="' + (gradeAnalysisSend.b - 1) + '" min="15">天</p>\
                                            <p>2.<input type="number" value="' + gradeAnalysisSend.b + '">---<input type="number" value="' + (gradeAnalysisSend.c - 1) + '">天</p>\
                                            <p>3.<input type="number" value="' + gradeAnalysisSend.c + '">---<input type="number" value="' + (gradeAnalysisSend.d - 1) + '">天</p>\
                                            <p>4.<input type="number" value="' + gradeAnalysisSend.d + '">天以上</p>\
                                        </div>',
                                onConfirm: function (event) {
                                    var spaceDay = [];
                                    $(".select_number input").each(function () {
                                        spaceDay.push($(this).val())
                                    });
                                    gradeAnalysisSend = {
                                        a: 14,
                                        b: spaceDay[2],
                                        c: spaceDay[4],
                                        d: spaceDay[6]
                                    };
                                    GradeAnalysisAjax(gradeAnalysisSend, function (items) {
                                        gradeAnalysisLink("gradeAnalysis", items);
                                        gradeAnalysisLink("cover", items);
                                    });
                                    close_cover();
                                }
                            });
                            $(".select_number input").blur(function () {
                                $(".select_number p").eq(
                                    ($(this).index() === 1 ?
                                        $(this).parent().index() + 1 :
                                        $(this).parent().index() )).find("input:eq(" + ($(this).index() === 0 ? 1 : 0) + ")").val(parseFloat($(this).val()) + 1).attr("min", parseFloat($(this).val()) + 1);
                            });
                        }
                    }
                }
            },
            legend: {
                orient: 'vertical',
                left: 0,
                top: 40,
                textStyle: {
                    color: "#FFF"
                },
                data: newArr,
                formatter: function (name) {
                    if (name === "今年") {
                        return name + "  " + (leng > 0 ? lists.thisYearjd : 0) + "人"
                    } else if (name === "去年") {
                        return name + "  " + (leng > 0 ? lists.lastYearjd : 0) + "人"
                    } else if (name === "前年") {
                        return name + "  " + (leng > 0 ? lists.beforeYearjd : 0) + "人"
                    } else {
                        return "其他" + "  " + (leng > 0 ? lists.otherYearjd : 0) + "人"
                    }
                }
            },
            series: [
                {
                    name: '浆员浆龄',
                    type: 'pie',
                    radius: [0, '50%'],
                    center: ['60%', '53%'],
                    label: {
                        normal: {
                            position: 'inner',
                            formatter: function (params) {
                                return params.data.value == 0 ? "" : params.name;
                            }
                        }
                    },
                    data: data.inside
                },
                {
                    name: '献浆间隔',
                    type: 'pie',
                    radius: ['60%', '80%'],
                    center: ['60%', '53%'],

                    label: {
                        normal: {
                            position: 'inner',
                            formatter: function (params) {
                                return params.data.value == 0 ? "" : (params.data.subCode === "10000" ? 4 : params.data.subCode);
                            }
                        }
                    },
                    data: (function () {
                        var datas = [];
                        for (var i in data.outside) {
                            var item = data.outside[i];
                            datas.push({
                                name: item.name,
                                value: item.value,
                                subName: item.subName,
                                subCode: item.subCode,
                                itemStyle: {
                                    normal: {
                                        color: (item.subCode === "1" && item.name === "今年") ? "#DB1C15" :
                                            (item.subCode === "2" && item.name === "今年") ? "#CB241F" :
                                                (item.subCode === "3" && item.name === "今年") ? "#B92E29" :
                                                    (item.subCode === "10000" && item.name === "今年") ? "#A73431" :
                                                        (item.subCode === "1" && item.name === "其它") ? "#2088CE" :
                                                            (item.subCode === "2" && item.name === "其它") ? "#2292DD" :
                                                                (item.subCode === "3" && item.name === "其它") ? "#3199DF" :
                                                                    (item.subCode === "10000" && item.name === "其它") ? "#3FA1E2" :
                                                                        (item.subCode === "1" && item.name === "前年") ? "#24ADBC" :
                                                                            (item.subCode === "2" && item.name === "前年") ? "#2998A5" :
                                                                                (item.subCode === "3" && item.name === "前年") ? "#2C7E89" :
                                                                                    (item.subCode === "10000" && item.name === "前年") ? "#2E6A71" :
                                                                                        (item.subCode === "1" && item.name === "去年") ? "#D37E15" :
                                                                                            (item.subCode === "2" && item.name === "去年") ? "#B7711C" :
                                                                                                (item.subCode === "3" && item.name === "去年") ? "#A56A21" :
                                                                                                    (item.subCode === "10000" && item.name === "去年") ? "#8E5F27" : "#5A5A5A"
                                    }
                                }
                            });
                        }
                        return datas;
                    }())
                }
            ]
        };
        myChart.clear();
        myChart.setOption(option);
    }


    /*
    * GanttChartLink
    * 生成采浆机运行（甘特图）图表
    * */
    function GanttLink(id, items) {

        //获取护士列表
        var nowNurseList = [];
        for (var n = 0; n < items.length; n++) {
            nowNurseList.push(items[n].nurse);
        }
        nurseListID = unique(nowNurseList);
        var myChart = echarts.init(document.getElementById(id));
        var names = ["安装耗材时间", "安装耗材后空闲时间", "穿刺时间", "采浆时间", "卸载耗材时间", "空闲时间"],
            categories = ["001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015", "016", "017", "018", "019", "020"];
        var azhc1 = gantChartData.installTakensSmall;
        var azhc2 = gantChartData.installTakensBig;
        var azhcSpace1 = gantChartData.installSpaceTakensSmall;
        var azhcSpace2 = gantChartData.installSpaceTakensBig;
        var puncture1 = gantChartData.punctureTakensSmall;
        var puncture2 = gantChartData.punctureTakensBig;
        var collect2_1 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.two.collectionTakensSmall : "";
        var collect2_2 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.two.collectionTakensBig : "";
        var collect3_1 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.three.collectionTakensSmall : "";
        var collect3_2 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.three.collectionTakensBig : "";
        var collect4_1 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.four.collectionTakensSmall : "";
        var collect4_2 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.four.collectionTakensBig : "";
        var collect5_1 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.five.collectionTakensSmall : "";
        var collect5_2 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.five.collectionTakensBig : "";
        var collect6_1 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.six.collectionTakensSmall : "";
        var collect6_2 = gantChartData.collectionTakens !== "" ? gantChartData.collectionTakens.six.collectionTakensBig : "";
        var xzhc1 = gantChartData.uninstallTakensSmall;
        var xzhc2 = gantChartData.uninstallTakensBig;
        var option = {
            color: [
                '#e95e48',
                '#DC951F',
                '#DDB100',
                '#DAD503',
                '#8AC867',
                '#37B8D4',
                '#7BCFE7',
                '#6A9BD3'
            ],
            title: {
                text: '当天单采机运行状况',
                subtext: "标准指标" + getSubText("安装耗材", azhc1, azhc2) + getSubText("安装耗材后空闲", azhcSpace1, azhcSpace2) + getSubText("穿刺", puncture1, puncture2) + getSubText("采浆第二层", collect2_1, collect2_2) + getSubText("采浆第三层", collect3_1, collect3_2) + getSubText("采浆第四层", collect4_1, collect4_2) + getSubText("采浆第五层", collect5_1, collect5_2) + getSubText("采浆第六层", collect6_1, collect6_2) + getSubText("卸载耗材", xzhc1, xzhc2),
                subtextStyle: {
                    color: '#97afcb',
                    fontSize: 12,
                    fontFamily: '微软雅黑'
                },
                textStyle: {
                    color: '#C8E1FD',
                    fontSize: 15,
                    fontFamily: '微软雅黑'
                }
            },
            tooltip: {
                backgroundColor: "#F6F6F6",
                borderWidth: 1,
                borderColor: "rgba(0,0,0,.3)",
                triggerOn: "click",
                confine: true,
                enterable: true,
                transitionDuration: 0,
                textStyle: {
                    color: "#333"
                },
                extraCssText: 'box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.3);',
                padding: [5, 10],
                position: function (pos, params, dom, rect, size) {
                    return [pos[0] + 10, pos[1]];
                },
                formatter: function (params) {
                    var matter;
                    var date = params.value[1].substr(0, 10),
                        machine = params.value[0],
                        name = params.data.name,
                        pulpName = params.value[4],
                        cardId = params.value[5],
                        nurse = params.value[6],
                        startT = params.value[1].substr(11, 8),
                        endT = params.value[2].substr(11, 8),
                        times = params.value[3],
                        spaceId = params.value[7],
                        layers = params.value[8];
                    matter =
                        '<a href="javascript:void(0);" onclick="openWorkingCharts(\'' + date + '\',\'' + machine + '\',\'' + name + '\',\'' + pulpName + '\',\'' + cardId + '\',\'' + nurse + '\',\'' + startT + '\',\'' + endT + '\',\'' + times + '\',\'' + spaceId + '\',\'' + layers + '\')">查看详情</a><br/>' +
                        machine + "&nbsp;---&nbsp;" + name + '<br/>' +
                        (name === "空闲时间" ? "" : "浆员：" + pulpName + '<br/>') +
                        (name === "空闲时间" ? "" : "卡号：" + cardId + '<br/>') +
                        (name === "空闲时间" ? "" : "操作护士：" + nurse + '<br/>') +
                        "时间段：" + startT + '&nbsp;---&nbsp;' + endT + '<br/>' +
                        '时长: ' + times + '<br/>' +
                        (name === "采浆时间" ? "采浆层数：" + layers : "");
                    return matter;
                }
            },
            legend: [
                {
                    top: 0,
                    left: 200,
                    textStyle: {
                        color: "#FFF"
                    },
                    selected: legendSelect,
                    data: (function () {
                        var newData = [];
                        for (var i = 0; i < names.length; i++) {
                            newData.push({
                                name: names[i],
                                icon: "circle"
                            })
                        }
                        return newData;
                    }())
                }
            ],
            toolbox: {
                itemSize: 22,
                feature: {
                    myTool1: {
                        show: true,
                        title: '放大',
                        icon: 'image://images/big.png',
                        onclick: function () {
                            big = "d";
                            $(".cover_big").fadeIn();
                            $("#cover").fadeIn();
                            GantChartAjax(gantChartData, function (items) {
                                GanttLink("cover", items);
                            });
                        }
                    },
                    myTool2: {
                        show: true,
                        title: '缩小',
                        icon: 'image://images/small.png',
                        onclick: function () {
                            big = "";
                            $(".cover_big").fadeOut();
                            $("#cover").fadeOut().removeAttr("_echarts_instance_").removeAttr("style");
                        }
                    },
                    myTool3: {
                        show: true,
                        title: '配置',
                        icon: 'image://images/setting.png',
                        onclick: function () {
                            var htmlStr = "";

                            function checked(id) {
                                var value = document.getElementById(id).value;
                                var str = nurseListID.join(",");
                                document.getElementById(id).checked = str.indexOf(value) === -1 ? false : true;
                            }

                            for (var i = 0; i < nurseList.length; i++) {
                                htmlStr += "<div>";
                                htmlStr += "<input id='nurse" + i + "' type='checkbox' name='nurse' value='" + nurseList[i].name + "' checked>";
                                htmlStr += "<label for='nurse" + i + "'>" + nurseList[i].name + "</label>";
                                htmlStr += "</div>";
                            }
                            modal_confirm({
                                title: '筛查',
                                content: '<div class="select_segment_nurse">' +
                                '<div>' +
                                '    <p><span>护士</span></p>' +
                                (htmlStr) +
                                '</div>' +
                                '<div id="search-data">' +
                                '<p><span>组合查询</span><span style="color:red;font-size:12px;border-left:none;">*以下请输入以00:00格式的分秒...</span></p>' +
                                '<ul class="select-gunter" style="width: 100%;padding: 0;">' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.installTakensSmall ? "checked" : "") + ' id="azhcIpt1" name="azhcIpt">' +
                                '<label for="azhcIpt1">安装耗材</label>' +
                                '<span> >= </span>' +
                                '<input id="azhc1" class="time1" type="text"  value="' + (gantChartData.installTakensSmall === "" ? configGantChartData.installTakensSmall : gantChartData.installTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.installTakensBig ? "checked" : "") + ' id="azhcIpt2" name="azhcIpt">' +
                                '<label for="azhcIpt2">安装耗材</label>' +
                                '<span> < </span>' +
                                '<input id="azhc2" class="time2" type="text" value="' + (gantChartData.installTakensBig === "" ? configGantChartData.installTakensBig : gantChartData.installTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.installSpaceTakensSmall ? "checked" : "") + ' id="azhcSpaceIpt1" name="azhcSpaceIpt">' +
                                '<label for="azhcSpaceIpt1">安装耗材后空闲时间</label>' +
                                '<span> >= </span>' +
                                '<input id="azhcSpace1" class="time1" type="text"  value="' + (gantChartData.installSpaceTakensSmall === "" ? configGantChartData.installSpaceTakensSmall : gantChartData.installSpaceTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.installSpaceTakensBig ? "checked" : "") + ' id="azhcSpaceIpt2" name="azhcSpaceIpt">' +
                                '<label for="azhcSpaceIpt2">安装耗材后空闲时间</label>' +
                                '<span> < </span>' +
                                '<input id="azhcSpace2" class="time2" type="text" value="' + (gantChartData.installSpaceTakensBig === "" ? configGantChartData.installSpaceTakensBig : gantChartData.installSpaceTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.punctureTakensSmall ? "checked" : "") + ' id="punctureIpt1" name="punctureIpt">' +
                                '<label for="punctureIpt1">穿刺时间</label>' +
                                '<span> >= </span>' +
                                '<input id="puncture1" class="time1" type="text" value="' + (gantChartData.punctureTakensSmall === "" ? configGantChartData.punctureTakensSmall : gantChartData.punctureTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.punctureTakensBig ? "checked" : "") + ' id="punctureIpt2" name="punctureIpt">' +
                                '<label for="punctureIpt2">穿刺时间</label>' +
                                '<span> < </span>' +
                                '<input id="puncture2" class="time2" type="text" value="' + (gantChartData.punctureTakensBig === "" ? configGantChartData.punctureTakensBig : gantChartData.punctureTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.two.collectionTakensSmall ? "checked" : "") + ' id="collect2Ipt1" name="collect2Ipt">' +
                                '<label for="collect2Ipt1">采浆时间第二层</label>' +
                                '<span> >= </span>' +
                                '<input id="collect2_1" class="time1" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.two.collectionTakensSmall) : configGantChartData.collectionTakens.two.collectionTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.two.collectionTakensBig ? "checked" : "") + ' id="collect2Ipt2" name="collect2Ipt">' +
                                '<label for="collect2Ipt2">采浆时间第二层</label>' +
                                '<span> < </span>' +
                                '<input id="collect2_2" class="time2" type="text"  value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.two.collectionTakensBig) : configGantChartData.collectionTakens.two.collectionTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.three.collectionTakensSmall ? "checked" : "") + ' id="collect3Ipt1" name="collect3Ipt">' +
                                '<label for="collect3Ipt1">采浆时间第三层</label>' +
                                '<span> >= </span>' +
                                '<input id="collect3_1" class="time1" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.three.collectionTakensSmall) : configGantChartData.collectionTakens.three.collectionTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.three.collectionTakensBig ? "checked" : "") + ' id="collect3Ipt2" name="collect3Ipt">' +
                                '<label for="collect3Ipt2">采浆时间第三层</label>' +
                                '<span> < </span>' +
                                '<input id="collect3_2" class="time2" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.three.collectionTakensBig) : configGantChartData.collectionTakens.three.collectionTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.four.collectionTakensSmall ? "checked" : "") + ' id="collect4Ipt1" name="collect4Ipt">' +
                                '<label for="collect4Ipt1">采浆时间第四层</label>' +
                                '<span> >= </span>' +
                                '<input id="collect4_1" class="time1" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.four.collectionTakensSmall) : configGantChartData.collectionTakens.four.collectionTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.four.collectionTakensBig ? "checked" : "") + ' id="collect4Ipt2" name="collect4Ipt">' +
                                '<label for="collect4Ipt2">采浆时间第四层</label>' +
                                '<span> < </span>' +
                                '<input id="collect4_2" class="time2" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.four.collectionTakensBig) : configGantChartData.collectionTakens.four.collectionTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.five.collectionTakensSmall ? "checked" : "") + ' id="collect5Ipt1" name="collect5Ipt">' +
                                '<label for="collect5Ipt1">采浆时间第五层</label>' +
                                '<span> >= </span>' +
                                '<input id="collect5_1" class="time1" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.five.collectionTakensSmall) : configGantChartData.collectionTakens.five.collectionTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.five.collectionTakensBig ? "checked" : "") + ' id="collect5Ipt2" name="collect5Ipt">' +
                                '<label for="collect5Ipt2">采浆时间第五层</label>' +
                                '<span> < </span>' +
                                '<input id="collect5_2" class="time2" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.five.collectionTakensBig) : configGantChartData.collectionTakens.five.collectionTakensBig) + '">' +
                                '</li>' +

                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.six.collectionTakensSmall ? "checked" : "") + ' id="collect6Ipt1" name="collect6Ipt">' +
                                '<label for="collect6Ipt1">采浆时间第六层</label>' +
                                '<span> >= </span>' +
                                '<input id="collect6_1" class="time1" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.six.collectionTakensSmall) : configGantChartData.collectionTakens.six.collectionTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.collectionTakens.six.collectionTakensBig ? "checked" : "") + ' id="collect6Ipt2" name="collect6Ipt">' +
                                '<label for="collect6Ipt2">采浆时间第六层</label>' +
                                '<span> < </span>' +
                                '<input id="collect6_2" class="time2" type="text" value="' + (gantChartData.collectionTakens !== "" ? (gantChartData.collectionTakens.six.collectionTakensBig) : configGantChartData.collectionTakens.six.collectionTakensBig) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.uninstallTakensSmall ? "checked" : "") + ' id="xzhcIpt1" name="xzhcIpt">' +
                                '<label for="xzhcIpt1">卸载耗材</label>' +
                                '<span> >= </span>' +
                                '<input id="xzhc1" class="time1" type="text" value="' + (gantChartData.uninstallTakensSmall === "" ? configGantChartData.uninstallTakensSmall : gantChartData.uninstallTakensSmall) + '">' +
                                '</li>' +
                                '<li>' +
                                '<input type="checkbox" ' + (gantChartIsChecked.uninstallTakensBig ? "checked" : "") + ' id="xzhcIpt2" name="xzhcIpt">' +
                                '<label for="xzhcIpt2">卸载耗材</label>' +
                                '<span> < </span>' +
                                '<input id="xzhc2" class="time2" type="text" value="' + (gantChartData.uninstallTakensBig === "" ? configGantChartData.uninstallTakensBig : gantChartData.uninstallTakensBig) + '">' +
                                '</li>' +
                                '</ul>' +
                                '</div>' +
                                '</div>',
                                onConfirm: function (event) {
                                    function isChecked_value(event) {
                                        var bool = event.parent().find("input[type=checkbox]").prop("checked");
                                        return bool ? event.val() : "";
                                    }

                                    function isChecked(event) {
                                        return event.parent().find("input[type=checkbox]").prop("checked");
                                    }

                                    var nursesList = [];
                                    $("input[name=nurse]:checked").each(function () {
                                        nursesList.push($(this).val())
                                    });
                                    var azhc1 = isChecked_value($("#azhc1"));
                                    var azhc2 = isChecked_value($("#azhc2"));
                                    var azhcSpace1 = isChecked_value($("#azhcSpace1"));
                                    var azhcSpace2 = isChecked_value($("#azhcSpace2"));
                                    var puncture1 = isChecked_value($("#puncture1"));
                                    var puncture2 = isChecked_value($("#puncture2"));
                                    var collect2_1 = isChecked_value($("#collect2_1"));
                                    var collect2_2 = isChecked_value($("#collect2_2"));
                                    var collect3_1 = isChecked_value($("#collect3_1"));
                                    var collect3_2 = isChecked_value($("#collect3_2"));
                                    var collect4_1 = isChecked_value($("#collect4_1"));
                                    var collect4_2 = isChecked_value($("#collect4_2"));
                                    var collect5_1 = isChecked_value($("#collect5_1"));
                                    var collect5_2 = isChecked_value($("#collect5_2"));
                                    var collect6_1 = isChecked_value($("#collect6_1"));
                                    var collect6_2 = isChecked_value($("#collect6_2"));
                                    var xzhc1 = isChecked_value($("#xzhc1"));
                                    var xzhc2 = isChecked_value($("#xzhc2"));

                                    gantChartData = {
                                        nurseListID: nursesList,
                                        installTakensSmall: azhc1,
                                        installTakensBig: azhc2,
                                        installSpaceTakensSmall: azhcSpace1,
                                        installSpaceTakensBig: azhcSpace2,
                                        punctureTakensSmall: puncture1,
                                        punctureTakensBig: puncture2,
                                        collectionTakens: {
                                            two: {
                                                collectionTakensSmall: collect2_1,
                                                collectionTakensBig: collect2_2
                                            },
                                            three: {
                                                collectionTakensSmall: collect3_1,
                                                collectionTakensBig: collect3_2
                                            },
                                            four: {
                                                collectionTakensSmall: collect4_1,
                                                collectionTakensBig: collect4_2
                                            },
                                            five: {
                                                collectionTakensSmall: collect5_1,
                                                collectionTakensBig: collect5_2
                                            },
                                            six: {
                                                collectionTakensSmall: collect6_1,
                                                collectionTakensBig: collect6_2
                                            }
                                        },
                                        uninstallTakensSmall: xzhc1,
                                        uninstallTakensBig: xzhc2
                                    };
                                    GantChartAjax(gantChartData, function (items) {
                                        GanttLink("gantt", items);
                                        GanttLink("cover", items);
                                    });
                                    gantChartIsChecked = {
                                        installTakensSmall: isChecked($("#azhc1")),
                                        installTakensBig: isChecked($("#azhc2")),
                                        installSpaceTakensSmall: isChecked($("#azhcSpace1")),
                                        installSpaceTakensBig: isChecked($("#azhcSpace2")),
                                        punctureTakensSmall: isChecked($("#puncture1")),
                                        punctureTakensBig: isChecked($("#puncture2")),
                                        collectionTakens: {
                                            two: {
                                                collectionTakensSmall: isChecked($("#collect2_1")),
                                                collectionTakensBig: isChecked($("#collect2_2"))
                                            },
                                            three: {
                                                collectionTakensSmall: isChecked($("#collect3_1")),
                                                collectionTakensBig: isChecked($("#collect3_2"))
                                            },
                                            four: {
                                                collectionTakensSmall: isChecked($("#collect4_1")),
                                                collectionTakensBig: isChecked($("#collect4_2"))
                                            },
                                            five: {
                                                collectionTakensSmall: isChecked($("#collect5_1")),
                                                collectionTakensBig: isChecked($("#collect5_2"))
                                            },
                                            six: {
                                                collectionTakensSmall: isChecked($("#collect6_1")),
                                                collectionTakensBig: isChecked($("#collect6_2"))
                                            }
                                        },
                                        uninstallTakensSmall: isChecked($("#xzhc1")),
                                        uninstallTakensBig: isChecked($("#xzhc2"))
                                    };
                                    if (azhc1 === "" && azhc2 === "" && azhcSpace1 === "" && azhcSpace2 === "" && puncture1 === "" && puncture2 === "" && collect2_1 === "" && collect2_2 === "" && collect3_1 === "" && collect3_2 === "" && collect4_1 === "" && collect4_2 === "" && collect5_1 === "" && collect5_2 === "" && collect6_1 === "" && collect6_2 === "" && xzhc1 === "" && xzhc2 === "") {
                                        legendSelect = {
                                            "安装耗材时间": true,
                                            "安装耗材后空闲时间": true,
                                            "穿刺时间": true,
                                            "采浆时间": true,
                                            "卸载耗材时间": true,
                                            "空闲时间": true
                                        };
                                    } else {
                                        legendSelect = {
                                            "安装耗材时间": ( isChecked($("#azhc1")) || isChecked($("#azhc2"))) ? true : false,
                                            "安装耗材后空闲时间": ( isChecked($("#azhcSpace1")) || isChecked($("#azhcSpace2"))) ? true : false,
                                            "穿刺时间": ( isChecked($("#puncture1")) || isChecked($("#puncture2"))) ? true : false,
                                            "采浆时间": ( isChecked($("#collect2_1")) || isChecked($("#collect2_2")) || isChecked($("#collect3_1")) || isChecked($("#collect3_2")) || isChecked($("#collect4_1")) || isChecked($("#collect4_2")) || isChecked($("#collect5_1")) || isChecked($("#collect5_2")) || isChecked($("#collect6_1")) || isChecked($("#collect6_2")) ) ? true : false,
                                            "卸载耗材时间": ( isChecked($("#xzhc1")) || isChecked($("#xzhc1"))) ? true : false,
                                            "空闲时间": false
                                        };
                                    }
                                    close_cover();
                                }
                            });
                            $(".modal.modal-confirm").css({
                                width: "600px",
                                height: "500px",
                                marginLeft: "-300px",
                                marginTop: "-250px"
                            });
                            $(".modal-content").css({height: "404px"});
                            checked("nurse0");
                            checked("nurse1");
                            checked("nurse2");
                            checked("nurse3");
                            checked("nurse4");
                            checked("nurse5");
                            checked("nurse6");
                            checked("nurse7");
                            checked("nurse8");
                            checked("nurse9");
                            /*
                             * search-data
                             * 失去焦点checkbox 选中
                             * */
                            $("#search-data input[type=text]").on("blur", function () {
                                if (!(isTime($(this).val()))) {
                                    alert("请输入00:00格式的分秒...");
                                    $(this).val("00:00");
                                } else {
                                    $(this).parent().find("input[type=checkbox]").prop("checked", true);
                                }
                            });
                        }
                    }
                }
            },
            grid: {
                left: 30,
                right: 20
            },
            dataZoom: [
                {
                    type: 'slider',
                    filterMode: 'weakFilter',
                    showDataShadow: true,
                    bottom: 10,
                    height: 5,
                    borderColor: 'transparent',
                    backgroundColor: '#e2e2e2',
                    handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z',
                    handleSize: 20,
                    handleStyle: {
                        shadowBlur: 6,
                        shadowOffsetX: 1,
                        shadowOffsetY: 2,
                        shadowColor: '#aaa'
                    },
                    labelFormatter: ''
                },
                {
                    type: 'inside',
                    filterMode: 'weakFilter'
                }
            ],
            xAxis: {
                type: 'time',
                splitNumber: 30,
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: "#F9F9F9"
                    }
                }
            },
            yAxis: {
                data: categories,
                axisLine: {
                    lineStyle: {
                        color: "#F9F9F9"
                    }
                }
            },
            series: (function () {
                var datas = [], series = [];
                for (var i = 0; i < items.length; i++) {
                    var all = items[i];
                    datas.push({
                        name: names[0],
                        value: [
                            all.machineNo,
                            all.installStartTime,
                            all.installEndTime,
                            all.installTakens,
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles
                        ]
                    });
                    datas.push({
                        name: names[1],
                        value: [
                            all.machineNo,
                            all.installSpaceStartTime,
                            all.installSpaceEndTime,
                            all.installSpaceTakens,
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles
                        ]
                    });
                    datas.push({
                        name: names[2],
                        value: [
                            all.machineNo,
                            all.punctureStartTime,
                            all.punctureEndTime,
                            all.punctureTakens,
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles
                        ]
                    });
                    datas.push({
                        name: names[3],
                        value: [
                            all.machineNo,
                            all.collectionStartTime,
                            all.collectionEndTime,
                            all.collectionTakens,
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles
                        ]
                    });
                    datas.push({
                        name: names[4],
                        value: [
                            all.machineNo,
                            all.uninstallStartTime,
                            all.uninstallEndTime,
                            all.uninstallTakens,
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles

                        ]
                    });
                    datas.push({
                        name: names[5],
                        value: [
                            all.machineNo,
                            all.spaceStartTime ? all.spaceStartTime : "",
                            all.spaceEndTime ? all.spaceEndTime : "",
                            all.spaceTakens ? all.spaceTakens : "",
                            all.providerName,
                            all.cardId,
                            all.nurse,
                            all.spaceSequence ? all.spaceSequence : "",
                            all.collectionCycles
                        ]
                    });
                }
                for (var k = 0; k < datas.length; k++) {
                    var item = datas[k];
                    series.push({
                        name: item.name,
                        type: 'custom',
                        encode: {
                            x: [1, 2],
                            y: 0
                        },
                        renderItem: function (params, api) {
                            var categoryIndex = api.value(0);
                            var start = api.coord([api.value(1), categoryIndex]);
                            var end = api.coord([api.value(2), categoryIndex]);
                            return {
                                type: 'rect',
                                shape: echarts.graphic.clipRectByRect(
                                    {
                                        x: start[0],
                                        y: start[1] - 2,
                                        width: end[0] - start[0],
                                        height: 10
                                    },
                                    {
                                        x: params.coordSys.x,
                                        y: params.coordSys.y,
                                        width: params.coordSys.width,
                                        height: params.coordSys.height
                                    }
                                ),
                                style: api.style()
                            };
                        },
                        itemStyle: {
                            normal: {
                                opacity: 0.8
                            }
                        },
                        data: [
                            {
                                name: item.name,
                                value: item.value
                            }
                        ]
                    })
                }
                return series;
            }())
        };
        myChart.setOption(option, true);
        placeholder.hide(document.body);
        $(".vii-holder-mask").hide();
    }


    /*
    * getWorkingChartsData
    * 请求运行图表数据（联动折线图）
    * */
    function getWorkingChartsData(date, cardId, callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/display/collectionChart",
            dataType: 'jsonp',
            data: {
                date: date,
                cardId: cardId
            },
            beforeSend: function () {
                placeholder.show(document.body)
            },
            success: function (list) {
                callback(list);
            },
            error: function (XMLHttpRequest) {
                alert("运行图表数据请求失败！")
                placeholder.hide(document.body);
                $(".vii-holder-mask").hide();
            }
        });
    }

    /*
       * openWorkingCharts
       * 打开运行图表（视频和联动折线图）详情
       * */
    function openWorkingCharts(date, machine, name, pulpNam, cardId, nurse, startT, endT, times, spaceId, layers) {
        big = "e";
        $(".cover_big").fadeIn();
        $("#cover").fadeIn();
        getWorkingChartsData(date, cardId, function (item) {
            initWorkingCharts(date, machine, name, pulpNam, cardId, nurse, startT, endT, times, spaceId, layers, item);
        });
    }

    /*
    * initWorkingCharts
    * 生成运行图表（视频和联动折线图）详情
    * */
    function initWorkingCharts(date, machine, name, pulpName, cardId, nurse, startT, endT, times, spaceId, layers, items) {
        var y = date.substr(0, 4);
        var m = date.substr(5, 1) === "0" ? date.substr(6, 1) : date.substr(5, 2);
        var d = date.substr(8, 1) === "0" ? date.substr(9, 1) : date.substr(8, 2);

        //视频
        var html = '<div id="gunterDetail">' +
            '<img src="images/small.png" width="25" alt="关闭" onclick="closeGunterDetail()">' +
            '<div class="video-detail">' +
            '<p><span>视频</span></p>' +
            '<ul style="width: ' + ((name === "安装耗材后空闲时间" || name === "采浆时间" || name === "空闲时间") ? "80%" : "40%") + '">' +
            '<li style="margin-right: 3%; width:' + ((name === "安装耗材后空闲时间" || name === "采浆时间" || name === "空闲时间") ? "47%" : "97%") + ' ">' +
            '<p>' + name + '视频</p>' +
            '<video src="http://60.164.210.223:7571/Nvr/video/' + y + '/' + m + '/' + d + '/' + ( name === "空闲时间" ? machine : y + m + d ) + ( name === "安装耗材时间" ? cardId + "i" : ( name === "安装耗材后空闲时间" ? cardId + "is" : ( name === "穿刺时间" ? cardId + "p" : ( name === "采浆时间" ? cardId + "c" : (name === "卸载耗材时间" ? cardId + "u" : spaceId + "s")))) ) + 'jy.mp4" autoplay controls preload loop></video>' +
            '</li>' +
            (
                (name === "安装耗材后空闲时间" || name === "采浆时间" || name === "空闲时间") ?
                    (
                        '<li>' +
                        '<p> ' + name + '环境视频</p>' +
                        '<video src="http://60.164.210.223:7571/Nvr/video/' + y + '/' + m + '/' + d + '/' + ( name === "空闲时间" ? machine : y + m + d ) + ( name === "安装耗材后空闲时间" ? cardId + "ise" : ( name === "采浆时间" ? cardId + "ce" : spaceId + "se")) + 'jy.mp4" autoplay controls preload loop></video>' +
                        '</li>'
                    ) : ""
            ) +
            '</ul>' +
            '<div class="video-right">' +
            '<div>' +
            '<p><span>浆员信息</span></p>' +
            '<div style="height: 100%;overflow: auto;">' +
            (
                '<p><em>采浆机号</em><span>' + machine + '</span></p>' +
                (name === "空闲时间" ? "" : "<p><em>浆员</em><span>" + pulpName + "</span></p>") +
                (name === "空闲时间" ? "" : "<p><em>卡号</em><span>" + cardId + "</span></p>") +
                (name === "空闲时间" ? "" : "<p><em>操作护士</em><span>" + nurse + "</span></p>") +
                '<p><em>开始时间</em><span>' + startT + '</span></p>' +
                '<p><em>结束时间</em><span>' + endT + '</span></p>' +
                '<p><em>时长</em><span>' + times + '</span></p>' +
                (name === "采浆时间" ? "<p><em>采浆层数</em><span>" + layers + "</span></p>" : "" )
            ) +
            '</div>' +
            '</div>' +
            '</div>' +
            '</div>' +
            (
                ( name !== "空闲时间") ?
                    (
                        '<div class="working-charts">' +
                        '<p><span>运行图表</span></p>' +
                        '<div>' +
                        '<div id="workingCharts1" style="width: 100%;margin-bottom: 10px;"></div>' +
                        '<div id="workingCharts2" style="width: 100%;margin-bottom: 10px;"></div>' +
                        '<div id="workingCharts3" style="width: 100%;margin-bottom: 10px;"></div>' +
                        '<div id="workingCharts4" style="width: 100%;margin-bottom: 10px;"></div>' +
                        '</div>' +
                        '</div>'
                    ) : ""
            ) +
            '</div>';
        $("#cover").html(html);
        $(".video-detail > ul").height($(".video-detail").height() - $(".video-detail>p").height());
        $(".video-detail video").height($(".video-detail li").height() - $(".video-detail li p").height() - 10);
        $(".video-right").height($(".video-detail ul").height() - 40);
        $(".video-right>div>div").height($(".video-right>div").height() - $(".video-right>div>p").height() - 30);

        if (name !== "空闲时间") {
            $(".working-charts > div").height($(".working-charts").height() - $(".working-charts>p").height());
            $(".working-charts > div > div").height($(".working-charts").height() - $(".working-charts>p").height());
            //运行图表
            var pulpWeight = [], centrifugeSpeed = [], redProbeVal = [], anticoagulantWeight = [],
                anticoagulantRotate = [],
                anticoagulantProp = [], bloodPumpSpeed = [], tubePressure = [], sleevePressure = [],
                anticoagulantSpeed = [], thisXBDrawRotate = [], thisXBReturnRotate = [], time = [];
            for (var i = 0; i < items.length; i++) {
                //第一个
                pulpWeight.push(items[i].xjdzc_WEIGHT);
                centrifugeSpeed.push(items[i].lxj_SPEED);
                redProbeVal.push(items[i].ht_VALUE);
                //第二个
                anticoagulantWeight.push(items[i].knjdzc_WEIGHT);
                anticoagulantRotate.push(items[i].knj_ROTATED);
                anticoagulantProp.push(items[i].knjb);
                //第三个
                bloodPumpSpeed.push(items[i].xb_SPEED);
                tubePressure.push(items[i].gy_VALUE);
                sleevePressure.push(items[i].xy_VALUE);
                //第四个
                anticoagulantSpeed.push(items[i].knj_SPEE);
                thisXBDrawRotate.push(items[i].cur_XB_DRAW_ROTATED);
                thisXBReturnRotate.push(items[i].cur_XB_RETURN_ROTATED);

                time.push(items[i].time);
            }

            // 配置图公共部分
            var commonWorking = {
                color: ['#e95e48', '#DC951F', '#DAD503', '#33CC99', '#37B8D4', '#6A9BD3'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        label: {
                            backgroundColor: '#6a7985'
                        }
                    }
                },
                grid: {
                    top: 30,
                    left: 0,
                    right: '2%',
                    bottom: 20,
                    containLabel: true
                },
                dataZoom: [
                    {
                        type: 'slider',
                        filterMode: 'weakFilter',
                        showDataShadow: true,
                        bottom: 5,
                        height: 5,
                        borderColor: 'transparent',
                        backgroundColor: '#e2e2e2',
                        handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z',
                        handleSize: 20,
                        handleStyle: {
                            shadowBlur: 6,
                            shadowOffsetX: 1,
                            shadowOffsetY: 2,
                            shadowColor: '#aaa'
                        },
                        labelFormatter: ''
                    },
                    {
                        type: 'inside',
                        filterMode: 'weakFilter'
                    }
                ],
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    splitLine: {show: false},
                    axisLine: {
                        onZero: false,
                        lineStyle: {
                            color: "#F9F9F9"
                        }
                    },
                    data: time.map(function (str) {
                        return str.replace(' ', '\n')
                    })
                }
            };

            function legend(arr) {
                return {
                    textStyle: {color: "#FFF"},
                    data: (function () {
                        var data = [];
                        for (var d = 0; d < arr.length; d++) {
                            data.push({
                                name: arr[d],
                                icon: 'circle'
                            })
                        }
                        return data;
                    }())
                }
            }

            function yAxis(name1, name2) {
                return [
                    {
                        type: 'value',
                        name: name1,
                        nameGap: 5,
                        nameTextStyle: {
                            color: "#37B8D4"
                        },
                        nameLocation: "end",
                        splitLine: {
                            show: false
                        },
                        axisLine: {
                            lineStyle: {
                                color: "#F9F9F9"
                            }
                        }
                    },
                    {
                        type: 'value',
                        name: name2,
                        nameGap: 5,
                        nameTextStyle: {
                            color: "#37B8D4"
                        },
                        splitLine: {
                            show: false
                        },
                        nameLocation: "end",
                        axisLine: {
                            lineStyle: {
                                color: "#F9F9F9"
                            }
                        }
                    }
                ]
            }

            //第一个（折线图）
            var list1 = ["血浆重量", "离心机速度", "红探值"];
            var myChart1 = echarts.init(document.getElementById("workingCharts1"));
            var option1 = {
                color: commonWorking.color,
                tooltip: commonWorking.tooltip,
                legend: legend(list1),
                grid: commonWorking.grid,
                dataZoom: commonWorking.dataZoom,
                xAxis: commonWorking.xAxis,
                yAxis: yAxis("速度", "重量"),
                series: (function () {
                    var series = [];
                    var data = [pulpWeight, centrifugeSpeed, redProbeVal];
                    for (var d = 0; d < data.length; d++) {
                        series.push({
                            name: list1[d],
                            type: 'line',
                            yAxisIndex: d === 0 ? 1 : 0,
                            data: data[d]
                        })
                    }
                    return series;
                }())
            };
            myChart1.clear();
            myChart1.setOption(option1);

            //第二个（折线图）
            var list2 = ["抗凝剂电子秤重量", "抗凝剂泵所转圈数", "抗凝剂全血比"];
            var myChart2 = echarts.init(document.getElementById("workingCharts2"));
            var option2 = {
                color: commonWorking.color,
                tooltip: commonWorking.tooltip,
                legend: legend(list2),
                grid: commonWorking.grid,
                dataZoom: commonWorking.dataZoom,
                xAxis: commonWorking.xAxis,
                yAxis: yAxis("重量", "圈数"),
                series: (function () {
                    var series = [];
                    var data = [anticoagulantWeight, anticoagulantRotate, anticoagulantProp];
                    for (var d = 0; d < data.length; d++) {
                        series.push({
                            name: list2[d],
                            type: 'line',
                            yAxisIndex: d === 1 ? 1 : 0,
                            markLine: {
                                silent: false,
                                data: [{yAxis: 0}],
                                symbolSize: 0,
                                label: {
                                    show: false
                                },
                                lineStyle: {
                                    color: "#CC0033",
                                    width: d === 0 ? 2 : 0,
                                    type: 'solid'
                                }
                            },
                            data: data[d]
                        })
                    }
                    return series;
                }())
            };
            myChart2.clear();
            myChart2.setOption(option2);

            //第三个（折线图）
            var list3 = ["血泵速度", "管压", "袖压"];
            var myChart3 = echarts.init(document.getElementById("workingCharts3"));
            var option3 = {
                color: commonWorking.color,
                tooltip: commonWorking.tooltip,
                legend: legend(list3),
                grid: commonWorking.grid,
                dataZoom: commonWorking.dataZoom,
                xAxis: commonWorking.xAxis,
                yAxis: yAxis("压力", "速度"),
                series: (function () {
                    var series = [];
                    var data = [bloodPumpSpeed, tubePressure, sleevePressure];
                    for (var d = 0; d < data.length; d++) {
                        series.push({
                            name: list3[d],
                            type: 'line',
                            yAxisIndex: d === 0 ? 1 : 0,
                            markLine: {
                                silent: false,
                                data: [{yAxis: 0}],
                                symbolSize: 0,
                                label: {
                                    show: false
                                },
                                lineStyle: {
                                    color: "#CC0033",
                                    width: d === 1 ? 2 : 0,
                                    type: 'solid'
                                }
                            },
                            data: data[d]
                        })
                    }
                    return series;
                }())
            };
            myChart3.clear();
            myChart3.setOption(option3);

            //第四个（折线图）
            var list4 = ["血泵速度", "抗凝剂泵速度", "当层血泵采集圈数", "当层血泵还输圈数"];
            var myChart4 = echarts.init(document.getElementById("workingCharts4"));
            var option4 = {
                color: commonWorking.color,
                tooltip: commonWorking.tooltip,
                legend: legend(list4),
                grid: commonWorking.grid,
                dataZoom: commonWorking.dataZoom,
                xAxis: commonWorking.xAxis,
                yAxis: yAxis("速度", "圈数"),
                series: (function () {
                    var series = [];
                    var data = [bloodPumpSpeed, anticoagulantSpeed, thisXBDrawRotate, thisXBReturnRotate];
                    for (var d = 0; d < data.length; d++) {
                        series.push({
                            name: list4[d],
                            type: 'line',
                            yAxisIndex: (d === 2 || d === 3) ? 1 : 0,
                            markLine: {
                                silent: false,
                                data: [{yAxis: 0}],
                                symbolSize: 0,
                                label: {
                                    show: false
                                },
                                lineStyle: {
                                    color: "#CC0033",
                                    width: d === 3 ? 2 : 0,
                                    type: 'solid'
                                }
                            },
                            data: data[d]
                        })
                    }
                    return series;
                }())
            };
            myChart4.clear();
            myChart4.setOption(option4);
            echarts.connect([myChart1, myChart2, myChart3, myChart4]);
        }

        placeholder.hide(document.body);
        $(".vii-holder-mask").hide();
    }


</script>
</html>